package co.th.bjc.md.init;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HibernateUtil {

	static ApplicationContext appContext;
	
	static void init(){
		appContext = new ClassPathXmlApplicationContext("resources/spring/config/BeanLocations.xml");
		
	}
	
	public static Object getService(String service_name){
		try{
			if (appContext == null){
				HibernateUtil.init();
			}
			return appContext.getBean(service_name);
		}catch(Exception ex){
			ex.printStackTrace();
			return null;
		}
	}
}
